package beans;

import entities.OrdenesCabecera;
import controllers.OrdenesCabeceraFacade;
import java.io.Serializable;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

@ManagedBean(name = "ordenesCabeceraController")
@ViewScoped
public class OrdenesCabeceraController extends AbstractController<OrdenesCabecera> implements Serializable {

    @EJB
    private OrdenesCabeceraFacade ejbFacade;

    public OrdenesCabeceraController() {
        super(OrdenesCabecera.class);
    }

    @PostConstruct
    public void init() {
        super.setFacade(ejbFacade);
    }

    @Override
    protected void setEmbeddableKeys() {
        this.getSelected().getOrdenesCabeceraPK().setCodCliente(this.getSelected().getClientes().getCodCliente());
    }

    @Override
    protected void initializeEmbeddableKey() {
        this.getSelected().setOrdenesCabeceraPK(new entities.OrdenesCabeceraPK());
    }
}
